/*
6. Write a program that asks the user for two numbers and calls the function you wrote in 
Exercise 5. Print the answer, or print an error message if you get -1.

5. Write a function that takes two unsigned short integer arguments and returns the result
 of dividing the first by the second. Do not do the division if the second number is zero, 
 but do return -1.
*/
#include <iostream.h>

float Divide (unsigned short int x, unsigned short int y) {
	if (!(y==0))
		return ((float) x / (float) y);
	else
		return -1;
};

int main(){
	unsigned short int x, y;
	float z;
	cout << "\nEnter two unsigned short integers.\n\tFirst number: ";
	cin >> x;
	cout << "\tSecond number: ";
	cin >> y;
	if((z=Divide(x,y))!=-1) 
		cout << "The first number divided by the second number is: " << z << endl;
	else
		cout << "\n\tSecond number cannot be zero! Sorry." << endl;
	return 0;
};
